package com.renli.controller;


import com.renli.pojo.User;
import com.renli.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/findAll")
    public String findUser(Model model) {
        List<User> all = userService.findAll();
        model.addAttribute("list", all);
        all.forEach(System.out::println);
        return "success";
    }
    @RequestMapping("/list")
    public String list(){
        return "user";
    }
}
